﻿namespace Janus.Cores.Logger
{
    /// <summary>
    /// Log管理类
    /// </summary>
    public static class LogManager
    {
        public static ILogger Default = new Log4NetLogger(log4net.LogManager.GetLogger("default"));
        public static ILogger Default2 = new Log4NetLogger(log4net.LogManager.GetLogger("default2"));

        //        public static ExceptionManager em = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();

        //        public static void Process(Action action)
        //        {
        //            em.Process(action, "Policy");
        //        }
        //        //private static readonly Logger logger = LogManager.GetCurrentClassLogger();
        //        public static void WriteLog(string msg)
        //        {
        //            var log = new LogEntry();
        //            log.Message = msg;
        //            WriteLog(log);
        //        }
        //        public static void WriteLog(LogEntry log)
        //        {
        //            Logger.Writer.Write(log);
        //            //ServiceFactory.LogWriter.Write(log);
        //        }


        //        public static void WriteLog(Exception ex)
        //        {
        //            try
        //            {
        //                if (ex.InnerException != null)
        //                {
        //                    ex = ex.InnerException;
        //                }
        //                em.Process(() => {  throw ex; }, "Policy");
        //            }
        //            catch (Exception e)
        //            {
        //#if DEBUG
        //                //throw e;
        //#endif
        //            }
        //        }
    }
}
